package com.leo.base.exception;

import com.leo.base.exception.result.impl.ResultCodeEnum;
import lombok.Data;
import lombok.ToString;

/**
 * 自定义全局异常处理
 *
 * @author wangss
 */
@Data
@ToString
public class CustomException extends RuntimeException {

    private Integer code;

    public CustomException(String message) {
        super(message);
        this.code = 111;
    }

    public CustomException(Integer code, String message) {
        super(message);
        this.code = code;
    }

    public CustomException(ResultCodeEnum resultCodeEnum) {
        super(resultCodeEnum.message());
        this.code = resultCodeEnum.code();
    }
}
